package my.study.java.util.concurrent.Callable;

import java.util.concurrent.Callable;

/**
 * 一个有ID的Callable示例
 * @author fanhongjie
 *
 */
public class CallableExample01 implements Callable<Integer> {

	private Integer id;
	
	private Long sleepTime;
	
	public CallableExample01(Integer id) {
		this.id = id;
		this.sleepTime = 1000L;
	}
	public CallableExample01(Integer id, Long sleepTime) {
		this.id = id;
		this.sleepTime = sleepTime;
	}
	public Integer call() throws Exception {
		System.out.println("CallableExample01.call() start id: " + id); 
		Thread.sleep(sleepTime);
		System.out.println("CallableExample01.call()  end  id: " + id); 
		return id;
	}

}
